Whenever a user invokes the API in order to make changes to the data or modify existing style, the CellChanged event is fired. If the events are triggered repeatedly in short time frames, this process may cause a significant overhead which in turn leaves negative impact on the overall performance.
Therefore, it is recommended to use the suspendEvent method and resumeEvent method especially when you're planning to incorporate a lot of changes at once but don't want to trigger any of the Spread events.
The suspendEvent method stops the event processing until all the changes are complete and the resumeEvent method allows you to restore the event processing. Both of these methods are useful in order to enhance performance while working with events in SpreadJS.
Refer to the following code snippet in order to use suspendEvent method and resumeEvent method in order to enhance performance while working with SpreadJS.
JavaScript |
Copy Code
|
---|---|
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss")); spread.suspendPaint(); /* The CellChanged event in this case will be fired for only Cell[22,2] sheet.setValue(22, 2, "222"); |